<?php 
class HeadController extends Controller{
	public function __init(){
		// 获得标签数据
		$headData = K('Category')->where("pid=0")->order('sort asc')->limit(6)->all();
		foreach ($headData as $k => $v) {
    		$headData[$k]['son']=K('Category')->where("pid={$v['cid']}")->limit(8)->all();
    	}
    	$this->assign('headData',$headData);
    	$hotCate = K('Category')->order('sort desc')->limit(8)->all();
    	$this->assign('hotCate',$hotCate);
    	// p($headData);
	}

	// 用户退出
	public function out(){
		session('user',null);
		session('uid',null);
		go(U('Index/Index/index'));
	}
}




 ?>